package exceptionExercise;

public class FinallyDemo {
    public static void main(String[] args) {
        System.out.println("程序开始被执行");
        try{
//            String line=null;
            String line="";
            System.out.println(line.length());
            return;//有异常就不会return,没有异常，先执行finally,再return

        }catch (Exception e){
            System.out.println("程序有异常，并被解决了");

        }finally {
            System.out.println("finally被执行了");
        }
        System.out.println("程序执行结束");
    }
}
